package com.service.impl;
import java.util.HashMap;
import java.util.Map;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.bean.LineTable;
import com.dao.LineTableDao;
import com.service.LineTableService;
import com.util.LoggerUtil;
import com.util.Pager;
@Component
public class LineTableServiceImpl implements LineTableService {
	public static Logger logger=Logger.getLogger(LineTableServiceImpl.class);
	@Autowired
	private LineTableDao lineTableDao;
	
	@Override
	public Map<String, Object> selectUsersLine(Integer curPage,Integer pageSize,String uid,String wuid,JSONObject logs) {
		Map<String, Object> map=new HashMap<String, Object>();
		try {
			Pager<LineTable> pager=lineTableDao.selectUsersLine(curPage, pageSize,uid,wuid);
		
			if(pager!=null&&pager.getData().size()>0){
				map.put("result", "success");
				map.put("rows", pager);
				LoggerUtil.backlogsSuccess(logs, logger);
			}else{
				map.put("result", "false");
				logs.put("result", "false(no data)");
				LoggerUtil.backlogsFalseNOData(logs, logger);
			}
		} catch (Exception e) {
			e.printStackTrace();
			map.put("code", "101");
			LoggerUtil.backlogsFalseError(logs, logger,e);
			return map;
		}
		return map;
	}
	
}
